<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	include("_include.user.judge.php");
	$kboy_user = $_SESSION['kboy_user'];
	$kboy_userid = $_SESSION['kboy_userid'];
	
	$action = chkstr(trim($_REQUEST['action']));
	$user_qq = chkstr(trim($_REQUEST['user_qq']));
	$user_msn = chkstr(trim($_REQUEST['user_msn']));
	
	$user_country = chkstr(trim($_REQUEST['user_country']));
	$user_localprov = chkstr(trim($_REQUEST['user_localprov']));
	$user_localcity = chkstr(trim($_REQUEST['user_localcity']));
	$user_localdist = chkstr(trim($_REQUEST['user_localdist']));
	$user_homeprov = chkstr(trim($_REQUEST['user_homeprov']));
	$user_homecity = chkstr(trim($_REQUEST['user_homecity']));
	$user_homedist = chkstr(trim($_REQUEST['user_homedist']));
	$user_birthday = chkstr(trim($_REQUEST['user_birthday']));
	$user_constellation = chkstr(trim($_REQUEST['user_constellation']));
	$user_income = chkstr(trim($_REQUEST['user_income']));
	$user_blood = chkstr(trim($_REQUEST['user_blood']));
	$user_figure = chkstr(trim($_REQUEST['user_figure']));
	$user_industry = chkstr(trim($_REQUEST['user_industry']));
	$user_maxim = chkstr(trim($_REQUEST['user_maxim']));
	$user_address = chkstr(trim($_REQUEST['user_address']));
	$user_passcode = chkstr(trim($_REQUEST['user_passcode']));
	
	if(empty($user_country)){
		$user_country = 0;
	}
	if(empty($user_constellation)){
		$user_constellation = 0;
	}
	if(empty($user_income)){
		$user_income = 0;
	}
	if(empty($user_blood)){
		$user_blood = 0;
	}
	if(empty($user_figure)){
		$user_figure = 0;
	}
	if(empty($user_industry)){
		$user_industry = 0;
	}

	if($action == "edit"){
		// 验证码验证
		if(strlen($user_passcode)<1){
			echo erro("请正确输入验证码！");
		}
		if(!isNumber($user_passcode)){
			echo erro("请正确输入验证码！");
		}
		if($user_passcode != $_SESSION['verifyCode']){
			echo erro("请正确输入验证码！");
		}
	
	
		// 修改数据
		$mysql = new sqlstr("kboy_user"); 
		$mysql -> set("user_qq",$user_qq);
		$mysql -> set("user_msn",$user_msn);
		$mysql -> set("user_country",$user_country,true);
		$mysql -> set("user_localprov",$user_localprov);
		$mysql -> set("user_localcity",$user_localcity);
		$mysql -> set("user_localdist",$user_localdist);
		$mysql -> set("user_homeprov",$user_homeprov);
		$mysql -> set("user_homecity",$user_homecity);
		$mysql -> set("user_homedist",$user_homedist);
		$mysql -> set("user_birthday",$user_birthday);
		$mysql -> set("user_constellation",$user_constellation,true);
		$mysql -> set("user_income",$user_income,true);
		$mysql -> set("user_blood",$user_blood,true);
		$mysql -> set("user_figure",$user_figure,true);
		$mysql -> set("user_industry",$user_industry,true);
		$mysql -> set("user_maxim",$user_maxim);
		$mysql -> set("user_address",$user_address);
		$news_sql = $mysql -> updateSql("uid=$kboy_userid");
		$news_res = mysql_query($news_sql);
		if($news_res){
			echo ok("操作成功","user_info.php");
		}else{
			echo erro("服务器内部错误");
		}

	}else{
		echo erro("参数错误");
	}
?>